<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">

	<rich:popupPanel id="popupEditar" modal="true" autosized="true"
		resizeable="false" domElementAttachment="parent">

		<f:facet name="header">
			<h:outputText value="#{msg.editarAsignatura}" />
		</f:facet>
		<f:facet name="controls">
			<h:commandButton value="X">
				<rich:componentControl target="popupEditar" operation="hide" />
			</h:commandButton>
		</f:facet>
		<h:form id="popupEditarForm">
			<h:panelGrid id="panelEditar" columns="3">
			
				<h:outputText value="#{msg.nombre}" />
				<h:inputText id="nombre" label="Nombre"
					value="#{asignaturasBean.asignaturaEditar.nombre}" required="true"
					requiredMessage="#{msg.requiredNombre}"
					validatorMessage="#{msg.validateNombre}">
					<f:validateLength maximum="50"/>
				</h:inputText>
				<rich:message for="nombre" ajaxRendered="true" />

				<h:outputText value="#{msg.curso}" />
				<h:inputText id="curso" label="Curso"
					value="#{asignaturasBean.asignaturaEditar.curso}" required="true"
					requiredMessage="#{msg.requiredCurso}"
					converterMessage="#{msg.converterCurso}"
					validatorMessage="#{msg.validateCurso}">
					<f:convertNumber integerOnly="true" />
					<f:validateLongRange minimum="1" maximum="5" />
				</h:inputText>
				<rich:message for="curso" ajaxRendered="true" />

				<h:outputText value="#{msg.creditos}" />
				<h:inputText id="creditos" label="Creditos"
					value="#{asignaturasBean.asignaturaEditar.credito}"
					required="true" requiredMessage="#{msg.requiredCreditos}"
					validatorMessage="#{msg.validateCreditos}">
					<f:validateDoubleRange minimum="1" maximum="15" />
				</h:inputText>
				<rich:message for="creditos" ajaxRendered="true" />

				<p />

				<a4j:commandButton value="#{msg.guardar}"
					actionListener="#{asignaturasBean.guardarAsignatura}"
					oncomplete="#{rich:component('popupEditar')}.hide(); return false;"
					render="panelListadoAsignaturas">
				</a4j:commandButton>
				<h:inputHidden value="#{asignaturasBean.asignaturaEditar.codAsignatura}" />
			</h:panelGrid>
		</h:form>
	</rich:popupPanel>
</ui:composition>